/*
 * @Author: your name
 * @Date: 2022-03-15 11:26:10
 * @LastEditTime: 2022-03-29 10:33:57
 * @LastEditors: Please set LastEditors
 * @FilePath: \VUE\app\src\api\index.js
 */
//当前模块统一对API进行管理

//引入axios
import requests from './request'

import mockRequest from './mockAjax'

//三级联动接口
// /api/product/getBaseCategoryList  get 无参数

export const reqCategoryList = () => requests({ url: '/product/getBaseCategoryList', method: 'get' })

//对外暴露mock模拟数据接口
//获取banner组件的数据

export const reqBannerList = () => mockRequest({ url: '/banner', method: 'get' })
//获取floor组件的数据
export const reqFloorList = () => mockRequest({ url: '/floor', method: 'get' })


//搜索接口
//搜索接口给服务器传递的params参数至少是一个空对象
export const reqGetSearchInfo = (params) => requests({ url: '/list', method: 'post', data: params })


//商品详情
//获取商品详细信息的接口
export const reqGoodsInfo = (skuId) => requests({ url: `/item/${skuId}`, method: 'get' })

//购物车
//将商品添加到购物车中，或者更新某一个商品数量
export const reqAddOrUpdateShopCart = (skuId, skuNum) => requests({ url: `cart/addToCart/${skuId}/${skuNum}`, method: 'post' })
//获取购物车数据接口
export const reqCartList = () => requests({ url: '/cart/cartList', method: 'get' })
//删除购物车数据接口
// /api/cart/deleteCart/{skuId}
export const reqDeleteCartById = skuId => requests({ url: `cart/deleteCart/${skuId}`, method: 'delete' })
//通过id修改勾选状态接口
// /api/cart/checkCart/{skuId}/{isChecked}
export const reqUpdateStateById = (skuId,isChecked) => requests({ url: `cart/checkCart/${skuId}/${isChecked}`, method: 'get' })

//注册
//获取注册验证码
// /api/user/passport/sendCode/{phone}
export const reqGetRegisterCode  = (phone) => requests({ url: `user/passport/sendCode/${phone}`, method: 'get' })
//注册用户
// /api/user/passport/register
export const reqRegisterUser = () => requests({ url: `user/passport/register`, method: 'post' })




